<?php $now_title = "联系我们";
require_once("head.php");

if(!empty($_POST)){
    $param = [
        'realname'  =>  isset($_POST['realname'])?leach($_POST['realname']):null,
        'email'  =>  isset($_POST['email'])?leach($_POST['email']):null,
        'tel'  =>  isset($_POST['tel'])?leach($_POST['tel']):null,
        'type'  =>  isset($_POST['type'])?leach($_POST['type']):null,
        'content'  =>  isset($_POST['content'])?leach($_POST['content']):null,
    ];
    $posttime = GetMkTime(time());
    $ip       = gethostbyname($_SERVER['REMOTE_ADDR']);

    $r = $dosql->GetOne("SELECT Max(orderid) AS orderid FROM `#@__message`");
    $orderid  = (empty($r['orderid']) ? 1 : ($r['orderid'] + 1));

    $contact = "电话：".$param['tel']." 邮箱：".$param['email'];
    $sql = "INSERT INTO `#@__message` (siteid, nickname, contact, content, orderid, posttime, htop, rtop, checkinfo, ip) VALUES (1, '".$param['realname']."', '$contact', '公司类型：".$param['type'].PHP_EOL."留言内容：".$param['content']."', '$orderid', '$posttime', '', '', 'false', '$ip')";
    if($dosql->ExecNoneQuery($sql))
    {
        ShowMsg('留言成功，感谢您的支持！','contact.php');
        exit();
    }
}
?>
<style type="text/css">
    
    body {
            background: url(hg/img/bj.jpg);
        }
</style>
    <div class="container" >
           <div style="margin-top: 3%; padding-bottom: 2%; color: #262626">
            
            <span class="">

                <a href="/">网站首页</a>
                &gt;
                <a href="">联系我们</a>
               
             </span>
        </div>

        <div class="contact_title">
            智道传媒·<i style="color: #3487E6;font-style: normal">欢迎社会各界与我们联系</i>
        </div>
        <div class="contact_title_en">
            WELCOME ALL SECTORS OF SOCIETY TO CONTACT US
        </div>
        
        <div class="contact_three" style="color:#3487E6; background-color: #fff ">
            <img src="hg/img/contact_tel.png" alt="">
            <?php echo $cfg_hotline ?>
        </div>
        <div class="contact_three" style="color:#3487E6;background-color: #fff ">
            <img src="hg/img/contact_email.png" alt="">
            <?php echo $cfg_email ?>
        </div>
        <div class="contact_three" style="font-size: 2rem;color:#3487E6;background-color: #fff" >
            <img src="hg/img/contact_dizhi.png" alt="">
            <?php echo $cfg_dizhi ?>
        </div>
        <div style="clear: both"></div>
        <div class="contact_title_2">
            如果您有任何意见建议想对我们说，都可以通过上面的方式发 送信息给我们。我们将非常乐意跟你畅快的交流！
        </div>
        <div class="contact_title_2">
            您也可以在下面给我们留言，我们将热忱为您服务
        </div>

        <form name="form" id="form" method="post" style="margin-top: 5%" action="">

            <input name="realname" type="text" id="realname" class="msg_input"  placeholder="请输入姓名" />

            <input name="tel" type="tel" id="tel" class="msg_input"  placeholder="请输入您的电话" />


            <input name="email" type="text" id="email" class="msg_input"   placeholder="请输入您的邮箱"/>
            <input name="type" type="text" id="type" class="msg_input"   placeholder="请输入您的公司类型"/>
            <div class="hr_10  d-none d-sm-block"></div>

            <textarea name="content" class="msg_input" id="content" style="width: 95%;line-height: 2;height: 180px"  placeholder="请输入您的具体需求" ></textarea>
            <div class="hr_10"></div><div class="hr_10"></div>
            <input class="submitbutten" type="button"  onclick="cfm_msg();return false;" value="提 交" style="background-color: #3487E6">
        </form>
        <script type="text/javascript">
            function cfm_msg()
            {
                if($("#realname").val() == "")
                {
                    alert("请输入姓名");
                    $("#contact").focus();
                    return false;
                }

                if($("#tel").val() == "")
                {
                    alert("请输入您的电话");
                    $("#contact").focus();
                    return false;
                }

                if($("#email").val() == "")
                {
                    alert("请输入您的邮箱");
                    $("#contact").focus();
                    return false;
                }
                if($("#content").val() == "")
                {
                    alert("请输入您的具体需求");
                    $("#contact").focus();
                    return false;
                }

                $("#form").submit();
            }
        </script>
    </div>

<?php require_once("footer.php");?>